import { render, screen } from "@testing-library/react";
import { TextHighlight } from "../components/TextHightlight";
import { mainColor } from "../utils";

test("TextHighlight 组件正确识别出高亮", () => {
  const text = "物料管理";
  const keyword = "管理";
  render(<TextHighlight text={text} keyword={keyword} />);
  expect(screen.getByText(keyword)).toBeInTheDocument();
  expect(screen.getByText(keyword)).toHaveStyle(`color: ${mainColor}`);
  expect(screen.getByText("物料")).not.toHaveStyle(`color: ${mainColor}`);
});
